package com.wn.exception;

import com.wn.bean.R;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author yellow Docter
 * @date 2022 -05-19
 * @desc
 *
 * @RestControllerAdvice 全局异常
 *
 *  @ExceptionHandler(AuthorizationException.class)
 *    捕获指定的 异常
 *      AuthorizationException 没有权限的异常
 */
@RestControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(AuthorizationException.class)
    public R handlerException(){
        return R.ERROR("没有权限操作...");
    }

}
